package actions.complaints;

import data.Complaint;
import data.Staff;
import actions.base.BaseAction;

public class Delete extends BaseAction {
	int id;
	boolean isPostBack;

	public void setId(int value) {
		id = value;
	}

	public int getId() {
		return id;
	}

	public void setIsPostBack(boolean value) {
		isPostBack = value;
	}

	@Override
	public String execute() {
		if (isPostBack) {
			services.deleteComplaintById(id);
			return redirect("Listing.action");
		}
		return SUCCESS;
	}

	public Complaint getComplaint() {
		return services.getComplaintByID(id);
	}

	public String getComplaintTitle() {
		return getComplaint().getComplaintTitle();
	}

}
